package com.mxy.myapplication.testtouchevent;

import android.content.Context;
import android.support.annotation.Nullable;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;

public class TestViewB extends View {

  public TestViewB(Context context) {
    super(context);
  }

  public TestViewB(Context context, @Nullable AttributeSet attrs) {
    super(context, attrs);
  }


  @Override
  public boolean dispatchTouchEvent(MotionEvent event) {
    System.out.println("ViewB   dispatchTouchEvent");
//    System.out.println(super.dispatchTouchEvent(event));
    return super.dispatchTouchEvent(event);
  }


  @Override
  public boolean onTouchEvent(MotionEvent event) {
    System.out.println("ViewB   onTouchEvent");
    switch(event.getAction()){
      case MotionEvent.ACTION_DOWN:
        System.out.println("ViewB   ACTION_DOWN");
        break;
      case MotionEvent.ACTION_MOVE:
        System.out.println("ViewB   ACTION_MOVE");
        break;
      case MotionEvent.ACTION_UP:
        System.out.println("ViewB   ACTION_UP");
        break;
    }
//    System.out.println(super.onTouchEvent(event));
    return super.onTouchEvent(event);
  }


}
